package com.yonyou.weixin.weixin_Utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 
 * @author qianjs163@163.com
 * @date 2016年11月16日
 */
public class Filetest {
	public static void main(String[] args) {

		StringBuilder sb = new StringBuilder();
		try {
			File file = null;
			for (int i = 925242; i < 1099023; i++) {
				file = new File(
						"C:\\Users\\Administrator\\Desktop\\log2\\201611321\\201611321\\201611321-" + i + ".log");
				if (!file.exists())
					continue;
				BufferedReader in = new BufferedReader(new FileReader(file));
				try {
					String s;
					while ((s = in.readLine()) != null) {
						sb.append(s);
					}
				} finally {
					in.close();
				}
				sb.append("\n");
				sb.append("===========");
				sb.append("\n");
			}
		} catch (IOException e) {
			throw new RuntimeException(e.getMessage());
		}

		PrintWriter out = null;
		try {
			out = new PrintWriter(new File("C:\\Users\\Administrator\\Desktop\\log3\\a2.txt"));
			out.print(sb.toString());
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} finally {
			out.close();
		}

		// int bufsize = 128;
		// try {
		// BufferedReader bufferedReader = new BufferedReader(
		// new FileReader(new
		// File("C:\\Users\\Administrator\\Desktop\\back\\201611318-531543.log")));
		// BufferedWriter bufferedWriter = new BufferedWriter(
		// new FileWriter(new
		// File("C:\\Users\\Administrator\\Desktop\\aa\\a.txt")));
		//
		// char buf[] = new char[bufsize]; // 字符缓冲区
		// while (bufferedReader.read(buf) != -1) {
		// bufferedWriter.write(buf);
		// }
		// bufferedWriter.flush();
		// bufferedReader.close();
		// bufferedWriter.close();
		//
		// } catch (FileNotFoundException e) {
		// e.printStackTrace();
		// } catch (IOException e) {
		// e.printStackTrace();
		// }
	}
}
